<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
          name="viewport">
    <meta content="ie=edge" http-equiv="X-UA-Compatible">
    <title>Document</title>
</head>
<body>
<!-- 1.编写位置一: 编写在html内部(了解) -->
<a href="#" onclick="alert('百度一下')">百度一下</a><br/>
<a href="javascript: alert('百度一下')">百度一下</a><br/>


<!-- 2.编写位置二: 编写在script元素之内 -->
<a class="google" href="#">Google一下</a><br/>

<script>
    var googleAEl = document.querySelector(".google")
    googleAEl.onclick = function () {
        alert("Google一下")
    }
</script>

<!-- 3.编写位置三: 独立的js文件 -->
<a class="bing" href="#">bing一下</a><br/>
<script src="./js/bing.js"></script>
</body>
</html>